# DP: Add .note.GNU-stack sections for gcc's crt files, libffi and boehm-gc
# DP: Taken from FC.

gcc/

2004-09-20  Jakub Jelinek  <jakub@redhat.com>

	* config/rs6000/ppc-asm.h: Add .note.GNU-stack section also
	on ppc64-linux.

	* config/ia64/lib1funcs.asm: Add .note.GNU-stack section on
	ia64-linux.
	* config/ia64/crtbegin.asm: Likewise.
	* config/ia64/crtend.asm: Likewise.
	* config/ia64/crti.asm: Likewise.
	* config/ia64/crtn.asm: Likewise.

2004-05-14  Jakub Jelinek  <jakub@redhat.com>

	* config/ia64/linux.h (TARGET_ASM_FILE_END): Define.

boehm-gc/

2005-02-08  Jakub Jelinek  <jakub@redhat.com>

	* ia64_save_regs_in_stack.s: Moved to...
	* ia64_save_regs_in_stack.S: ... this.  Add .note.GNU-stack
	on Linux.

libffi/

2007-05-11  Daniel Jacobowitz  <dan@debian.org>

	* src/arm/sysv.S: Fix ARM comment marker.

2005-02-08  Jakub Jelinek  <jakub@redhat.com>

	* src/alpha/osf.S: Add .note.GNU-stack on Linux.
	* src/s390/sysv.S: Likewise.
	* src/powerpc/linux64.S: Likewise.
	* src/powerpc/linux64_closure.S: Likewise.
	* src/powerpc/ppc_closure.S: Likewise.
	* src/powerpc/sysv.S: Likewise.
	* src/x86/unix64.S: Likewise.
	* src/x86/sysv.S: Likewise.
	* src/sparc/v8.S: Likewise.
	* src/sparc/v9.S: Likewise.
	* src/m68k/sysv.S: Likewise.
	* src/ia64/unix.S: Likewise.
	* src/arm/sysv.S: Likewise.

---
 boehm-gc/ia64_save_regs_in_stack.s   |   12 ------------
 gcc/config/ia64/crtbegin.asm         |    4 ++++
 gcc/config/ia64/crtend.asm           |    4 ++++
 gcc/config/ia64/crti.asm             |    4 ++++
 gcc/config/ia64/crtn.asm             |    4 ++++
 gcc/config/ia64/lib1funcs.asm        |    4 ++++
 gcc/config/ia64/linux.h              |    2 ++
 gcc/config/rs6000/ppc-asm.h          |    2 +-
 libffi/src/ia64/unix.S               |    4 ++++
 libffi/src/powerpc/linux64.S         |    4 ++++
 libffi/src/powerpc/linux64_closure.S |    4 ++++
 11 files changed, 35 insertions(+), 13 deletions(-)

--- a/src/boehm-gc/ia64_save_regs_in_stack.s
+++ b/src/boehm-gc/ia64_save_regs_in_stack.s
@@ -1,12 +0,0 @@
-        .text
-        .align 16
-        .global GC_save_regs_in_stack
-        .proc GC_save_regs_in_stack
-GC_save_regs_in_stack:
-        .body
-        flushrs
-        ;;
-        mov r8=ar.bsp
-        br.ret.sptk.few rp
-        .endp GC_save_regs_in_stack
-
--- a/src/boehm-gc/ia64_save_regs_in_stack.S
+++ b/src/boehm-gc/ia64_save_regs_in_stack.S
@@ -0,0 +1,15 @@
+        .text
+        .align 16
+        .global GC_save_regs_in_stack
+        .proc GC_save_regs_in_stack
+GC_save_regs_in_stack:
+        .body
+        flushrs
+        ;;
+        mov r8=ar.bsp
+        br.ret.sptk.few rp
+        .endp GC_save_regs_in_stack
+
+#ifdef __linux__
+	.section .note.GNU-stack,"",@progbits
+#endif
--- a/src/gcc/config/ia64/crtbegin.asm
+++ b/src/gcc/config/ia64/crtbegin.asm
@@ -255,3 +255,7 @@ __do_jv_register_classes:
 .weak __cxa_finalize
 #endif
 .weak _Jv_RegisterClasses
+
+#ifdef __linux__
+.section .note.GNU-stack; .previous
+#endif
--- a/src/gcc/config/ia64/crtend.asm
+++ b/src/gcc/config/ia64/crtend.asm
@@ -122,3 +122,7 @@ __do_global_ctors_aux:
 
 	br.ret.sptk.many rp
 	.endp __do_global_ctors_aux
+
+#ifdef __linux__
+.section .note.GNU-stack; .previous
+#endif
--- a/src/gcc/config/ia64/crti.asm
+++ b/src/gcc/config/ia64/crti.asm
@@ -62,3 +62,7 @@ _fini:
 	.body
 
 # end of crti.asm
+
+#ifdef __linux__
+.section .note.GNU-stack; .previous
+#endif
--- a/src/gcc/config/ia64/crtn.asm
+++ b/src/gcc/config/ia64/crtn.asm
@@ -52,3 +52,7 @@
 	br.ret.sptk.many b0
 
 # end of crtn.asm
+
+#ifdef __linux__
+.section .note.GNU-stack; .previous
+#endif
--- a/src/gcc/config/ia64/lib1funcs.asm
+++ b/src/gcc/config/ia64/lib1funcs.asm
@@ -796,3 +796,7 @@ __floattitf:
 	.endp __floattitf
 #endif
 #endif
+
+#ifdef __linux__
+.section .note.GNU-stack; .previous
+#endif
--- a/src/gcc/config/ia64/linux.h
+++ b/src/gcc/config/ia64/linux.h
@@ -5,6 +5,8 @@
 
 #define TARGET_VERSION fprintf (stderr, " (IA-64) Linux");
 
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
+
 /* This is for -profile to use -lc_p instead of -lc.  */
 #undef CC1_SPEC
 #define CC1_SPEC "%{profile:-p} %{G*}"
--- a/src/gcc/config/rs6000/ppc-asm.h
+++ b/src/gcc/config/rs6000/ppc-asm.h
@@ -172,7 +172,7 @@ GLUE(.L,name): \
 	.size FUNC_NAME(name),GLUE(.L,name)-FUNC_NAME(name)
 #endif
 
-#if defined __linux__ && !defined __powerpc64__
+#if defined __linux__
 	.section .note.GNU-stack
 	.previous
 #endif
--- a/src/libffi/src/ia64/unix.S
+++ b/src/libffi/src/ia64/unix.S
@@ -553,3 +553,7 @@ ffi_closure_unix:
 	data8	@pcrel(.Lld_hfa_float)		// FFI_IA64_TYPE_HFA_FLOAT
 	data8	@pcrel(.Lld_hfa_double)		// FFI_IA64_TYPE_HFA_DOUBLE
 	data8	@pcrel(.Lld_hfa_ldouble)	// FFI_IA64_TYPE_HFA_LDOUBLE
+
+#if defined __ELF__ && defined __linux__
+	.section	.note.GNU-stack,"",@progbits
+#endif
--- a/src/libffi/src/powerpc/linux64.S
+++ b/src/libffi/src/powerpc/linux64.S
@@ -179,3 +179,7 @@ ffi_call_LINUX64:
 	.align 3
 .LEFDE1:
 #endif
+
+#if defined __ELF__ && defined __linux__
+	.section	.note.GNU-stack,"",@progbits
+#endif
--- a/src/libffi/src/powerpc/linux64_closure.S
+++ b/src/libffi/src/powerpc/linux64_closure.S
@@ -204,3 +204,7 @@ ffi_closure_LINUX64:
 	.align 3
 .LEFDE1:
 #endif
+
+#if defined __ELF__ && defined __linux__
+	.section	.note.GNU-stack,"",@progbits
+#endif
